package com.qf.util;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;

/**
 * 2019/11/13
 * Administrator
 * spring_proxy
 * 面向对象面向君  不负代码不负卿
 */
//增强类
public class MyAop {
    //前置增强
    public void abc(JoinPoint joinPoint){
        System.out.println("aop前置增强");
        System.out.println("参数列表:"+joinPoint.getArgs()[0]);
        System.out.println("目标方法:"+joinPoint.getSignature().getName());
        System.out.println("目标方法所在的对象类:"+joinPoint.getTarget());
    }
    //后置增强
    public void hou(){
        System.out.println("后置增强");
    }
    //环绕增强
    public void around(ProceedingJoinPoint joinPoint) throws  Throwable{
        System.out.println("环绕前置增强");
        Object proceed = joinPoint.proceed();//执行目标方法
        System.out.println("环绕后置增强");
    }
    //异常增强
    public  void exception(){
        System.out.println("异常增强");
    }
    //最终增强
    public void afterall(){
        System.out.println("afterall");
    }
}
